using System;

using WP.MF.DataEntity;
using WP.DB;
using WP.Commons;



namespace WP.MF.DataAccess
{
	/// <summary>
	/// Summary description for MFieldValueDictDAL.
	/// </summary>
    public class MFieldValueDictDAL
	{
		public MFieldValueDictDAL()
		{
			//
			// TODO: Add constructor logic here
			//
		}
      
      /// <summary>
      /// Select Filed Value .if table name does not equal empty and  field name does not equal empty,select all fields 
      /// </summary>
      /// <param name="dBAccess"></param>
      /// <param name="tableName"></param>
      /// <param name="fieldName"></param>
      /// <returns></returns>
      public MFieldValueDictDEL SelectFieldValues(DBAccess dBAccess,string strTableName,string strFieldName)
      {
         MFieldValueDictDEL mFieldValueDictDEL=new MFieldValueDictDEL();
         
         string strSql="";
         
         strSql=@"SELECT RecId, TableName, FieldName, FieldValue, FieldDesc, OrderByValue, RecStamp FROM mFieldValueDict ";
         
         if (strTableName!=null && strFieldName!=null && strTableName!="" && strFieldName!="")
         {
            strSql+=" WHERE rtrim(TableName)='"+strTableName+"' AND rtrim(fieldName)='"+strFieldName+"'";
         }
         
         dBAccess.GetDataSet(strSql,MFieldValueDictDEL.TABLENAME_MFIELDVALUEDICT,mFieldValueDictDEL);
         
         return mFieldValueDictDEL;
      }
	}
}
